package com.solution.admin.customer.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.solution.admin.customer.dao.CompanyExpressConfigAddressDao;
import com.solution.admin.customer.entity.CompanyExpressConfigAddressEntity;
import com.solution.admin.customer.service.CompanyExpressConfigAddressService;
import com.solution.common.dao.BaseDao;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;
import com.solution.common.service.impl.BaseServiceImpl;
import com.solution.common.utils.string.StringUtil;

/**
 * 公司常用物流配置-地址列表service实现层
 * @author solin
 * @date 2018-03-22 18:51:24
 */
@Service
public class CompanyExpressConfigAddressServiceImpl extends BaseServiceImpl<CompanyExpressConfigAddressEntity> implements CompanyExpressConfigAddressService {

	/**
	 * 公司常用物流配置-地址列表接口
	 */
	@Autowired
	private CompanyExpressConfigAddressDao companyExpressConfigAddressDao;

	protected BaseDao<CompanyExpressConfigAddressEntity> getDao() {
		return this.companyExpressConfigAddressDao;
	}

	/**
	 * 保存公司常用物流配置-地址列表
	 * @param companyExpressConfigAddressEntity 公司常用物流配置-地址列表实体
	 * @return Long 添加成功公司常用物流配置-地址列表的ID
	 * @author solin
	 * @date 2018-03-22 18:51:24
	 */
	public long saveCompanyExpressConfigAddress(CompanyExpressConfigAddressEntity companyExpressConfigAddressEntity) {
		return companyExpressConfigAddressDao.saveCompanyExpressConfigAddress(companyExpressConfigAddressEntity);
	}
	
	public long saveCompanyExpressConfigAddress(List<CompanyExpressConfigAddressEntity> companyExpressConfigAddressList) {
		return companyExpressConfigAddressDao.saveCompanyExpressConfigAddress(companyExpressConfigAddressList);
	}

	/**
	 * 分页查询公司常用物流配置-地址列表
	 * @param pageParam 分页参数
	 * @param paramMap 查询参数
	 * @return PageBean 分页参数和分页数据
	 * @author solin
	 * @date 2018-03-22 18:51:24
	 */
	@Override
	public PageBean listCompanyExpressConfigAddressPage(PageParam pageParam, Map<String, Object> paramMap) {
		return companyExpressConfigAddressDao.listCompanyExpressConfigAddressPage(pageParam, paramMap);
	}
	
	/**
	 * 根据ID查询用户信息
	 * @param id 用户id
	 * @return companyExpressConfigAddressEntity 用户对象
	 * @author solin
	 * @date 2018-03-22 18:51:24
	 */
	public CompanyExpressConfigAddressEntity getCompanyExpressConfigAddressById(Long id) {
		return companyExpressConfigAddressDao.getById(id.longValue());
	}

	/**
	 * 更新用户
	 * @param companyExpressConfigAddressEntity 用户实体
	 * @return Long 更新是否成功，>1代表更新成功
	 * @author solin
	 * @date 2018-03-22 18:51:24
	 */
	@Override
	public int updateCompanyExpressConfigAddress(CompanyExpressConfigAddressEntity companyExpressConfigAddressEntity) {
		return companyExpressConfigAddressDao.updateCompanyExpressConfigAddress(companyExpressConfigAddressEntity);
	}
	
	
	/**
	 * 根据条件查询公司常用物流配置-地址列表
	 * @param param
	 * @return 数据列表
	 * @author solin
	 * @date 2018-03-22 18:51:24
	 */
	@Override
	public List<CompanyExpressConfigAddressEntity> listCompanyExpressConfigAddress( Map<String, Object> param){
		return  companyExpressConfigAddressDao.listCompanyExpressConfigAddress(param);
	}
	
	/**
	 * 删除公司常用物流配置-地址列表
	 * @param 
	 * @return int 返回删除记录条数
	 * @author solin
	 * @date 2018-03-22 18:51:24
	 */
	public int deleteCompanyExpressConfigAddressById(long id){
		return  companyExpressConfigAddressDao.deleteById(id);
	}
	
	public int deleteCompanyExpressConfigAddressByCompanyId(long companyId){
		return  companyExpressConfigAddressDao.deleteCompanyExpressConfigAddressByCompanyId(companyId);
	}

	/**
	 * 查询该公司地址是否免运费
	 * @param paramMap
	 * @return
	 * @author xkl
	 * @date 2018年3月23日 下午4:53:13
	 */
	@Override
	public int countByCompanyIdAndAddressId(Map<String, Object> paramMap) {
		return companyExpressConfigAddressDao.countByCompanyIdAndAddressId(paramMap);
	}
	
}
